<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->string('avatar')->nullable()->after('phone')->comment('头像');
            $table->string('nickname')->nullable()->after('avatar')->comment('昵称');
            $table->string('signature')->nullable()->after('nickname')->comment('个性签名');
            $table->text('bio')->nullable()->after('signature')->comment('简介');
            $table->unsignedInteger('exp')->default(0)->after('bio')->comment('经验值');
            // 注意：角色不在 users 表中，而是在 bar_members 表中按贴吧管理
            // 这里只保留全局管理员角色
            $table->boolean('is_admin')->default(false)->after('exp')->comment('是否为全局管理员');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->dropColumn(['avatar', 'nickname', 'signature', 'bio', 'exp', 'is_admin']);
        });
    }
};
